<?php
class emailController extends userController {

	//发送邮件
    public function post($email,$title,$content){
        @ignore_user_abort(true); 
    	@set_time_limit(0);
    	$sys_config=config('APP');
    	if($_POST['SAFE_KEY']<>$sys_config['SAFE_KEY']){
            return false;
        }
    	$email=$_POST['email'];
    	$title=$_POST['title'];
    	$content=$_POST['content'];

        $config=appConfig('member');
        $config=$config['APP_SETTING'];
        $config['SMTP_HOST']=$config['smtp_host'];
        $config['SMTP_PORT']=intval($config['smtp_port']);
        $config['SMTP_SSL']=intval($config['smtp_ssl']);
        $config['SMTP_USERNAME']=$config['smtp_username'];
        $config['SMTP_PASSWORD']=$config['smtp_password'];
        $config['SMTP_FROM_TO']=$config['smtp_username'];
        $config['SMTP_FROM_NAME']=$config['smtp_form_name'];
        $config['SMTP_CHARSET']='utf-8';
        ob_start();
        Email::init($config);
        Email::send($email,$title,$content);
        $msg=ob_get_contents();
        ob_end_clean();

        if(!empty($msg)){
            return $msg;
        }else{
            return true;
        }
    }


}